define(function () {

    var self;
    var yspj = app.Module.extend({

        init: function () {
            self = this;
            self.mData = {
                orderSet: {}
            };
            self.searchData = {
                keyword: ''
            }
            self._super({
                _tag: 'p_yspj', // key, 对象放进pageModule
                _sliderId: 'slider', // tabs
                _refreshAutoInit: true //自动加载刷新控件
            }, win);

            mui.ready(function () {

                Vue.component('yspj-listitem', {
                    template: app.getByid(doc, 'item-template'),
                    props: {
                        model: Array
                    },
                    methods: {
                        showDetail: function (item) { //跳转到进度查询页面
                            app.openPage({
                                src: "yspj/yspj-info.html",
                                argsKey: 'yspjinfo_page',
                                args: item
                            });
                        }
                    }
                });

            });
        },
        _search:function(d){
            self.searchData.keyword = d.keyword.trim();
            self._refresh();
        },
        _initRefresh: function () { // 实例化刷新组件
            if (self._refreshIds.length == 0) {
                self._refreshIds = ['scrollN', 'scrollY'];
            }
            this._super(win);
        },
        _refreshCb: function (goods) {// 刷新组件回调函授
            var _super = this._super;
            app.ajax({
                xurl: "api/wx/gwat810/getGwcuDatas",
                // xtime: '1d',
                xdata: {
                    page:goods.page +1,
                    limit: goods.limit,
                    GWAA003:app.cookie('_WX_ACCOUNT_'),//获取微信号
                    status: goods.type.replace('scroll', ''),//注意页面上 不是1 2 3 是 Y N
                    keyword: self.searchData.keyword,//输入的查询条件 ：产品编号、意向客户姓名
                },
                cb: function (result) {
                    if (result.ok) {
                        var data = result.data;
                        goods.data.pushArray(data.data.addMap({
                            checked: false
                        }), goods.page == 0);

                        _super({
                            obj: goods,
                            dataLen: data.data.length,
                            nodata: self._refreshIndex == 0 ? '无未评价询单...' : (self._refreshIndex == 1 ? '无已评价询单...' : '无询单...')
                        });
                    }
                }
            });

        },
        _lazy: function () {
            this._super();
        }
    });

    return new yspj();

});